package com.project.page;

public class Page {
	 private int pageNo;			//当前页			1
	 private int pageSize;			//每页显示的数量	3
	 private int totalCount;		//总条数
	 
	 private int startRow;			//起始行位置（pageNo当前页-1）*每页显示的数量
	 private int totalPageCount;	//总分页数
	public int getPageNo() {
		return pageNo;
	}
	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}
	public int getStartRow() {
		return startRow;
	}
	//计算起始行位置
	public void setStartRow(int pageNo,int pageSize) {
		this.startRow = (pageNo-1)*pageSize;
	}
	public int getTotalPageCount() {
		return totalPageCount;
	}
	//总页数
	public void setTotalPageCount(int totalCount,int pageSize) {
		this.totalPageCount = totalCount%pageSize==0? totalCount/pageSize: totalCount/pageSize+1;
	}
	public Page(int pageNo, int pageSize, int totalCount) {
		this.pageNo = pageNo;
		this.pageSize = pageSize;
		this.totalCount = totalCount;
		this.setStartRow(pageNo, pageSize);
		this.setTotalPageCount(totalCount, pageSize);
	}
	
	
	
}
